home *** CD-ROM | disk | FTP | other *** search
/ Singles Flirt Up Your Life! (German) / Singles Flirt Up Your Life.iso / data1.cab / Statemachine / questFriendship7.lua < prev    next >
Text File  |  2004-01-29  |  2KB  |  64 lines

  1. beginStateMachine()
  2.  
  3.     -- called when questor builds up all known questScripts
  4.     onEnter(function(msg)
  5.         print("questFriendship7 entered");
  6.         setState("initial");
  7.     end )
  8.     
  9.     -- on game over: relationship conditions get reset to 0 and all quests are reset to initial
  10.     onMsg("questreset", function(msg)
  11.         setState("initial");
  12.     end ) 
  13. ---------------------------------------------------------------------------------------------------------------------------------------    
  14.     
  15.     state("initial") 
  16.         onMsg("checkCondition", function(msg)
  17.             local mike = getParent().getParent().getCharacter(MIKE);
  18.             local elaine = getParent().getParent().getCharacter(ELAINE);
  19.  
  20.             if ( -- condition here
  21.         ----------------
  22.                 min(    mike.getRelationshipCondition(ELAINE, REL_FRIENDSHIP),
  23.                     elaine.getRelationshipCondition(MIKE, REL_FRIENDSHIP)) >= 7)
  24.         ----------------
  25.             then
  26.                 -- go to talk position
  27.                 elaine.queueCommand("pm_talkCutscene", "talkCutscene", mike, "questFriendship8");
  28.                 setState("talktome");
  29.             end
  30.         end )
  31.         
  32.         
  33.     state("talktome")
  34.         -- as soon as arrived - start dialog (interaction.talkCutscene sends talking)
  35.         onMsg("talking", function(msg)
  36.             if (msg.data == "questFriendship8") then
  37.                 popupConversation("dialogFriendship7");
  38.                 setState("donetalktome");
  39.             end 
  40.         end )
  41.         
  42.     state("donetalktome");
  43.         -- last dialog box clicked away
  44.         onMsg("yes", function(msg)
  45.             -- cancel
  46.             local mike = getParent().getParent().getCharacter(MIKE);
  47.             local elaine = getParent().getParent().getCharacter(ELAINE);
  48.  
  49.             mike.cancelCurrentActivity();
  50.             elaine.cancelCurrentActivity();
  51.             setState("done");
  52.         end )
  53.         
  54. ---------------------------------------------------------------------------------------------------------------------------------------    
  55.  
  56.         
  57.     state("done")
  58.     
  59.     -- sackgasse hier
  60.         
  61.         
  62.         
  63. endStateMachine()
  64.